<!DOCTYPE html>
<html class="index_body">
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=10">
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">
    <title>上传合同</title>
    <link rel="stylesheet" href="/Public/mui/computer/css/bootstrap.css"/>
    <link rel="stylesheet"  href="/Public/mui/static/bower_components/sweetalert/dist/sweetalert.css">
    <link rel = "stylesheet" href = "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css">  
    <link rel="stylesheet" href="/Public/mui/computer/css/index.css"/>
    <style>
      #file_name{
        width: 100px;
        height: 30px;
      }

      #file_name_data{
        width: 100px;
        height: 30px;
      }
      a.input {
        width:70px;
        height:30px;
        line-height:30px;
        background:#3091d1;
        text-align:center;
        display:inline-block;
        overflow:hidden;
        position:relative;
        top:10px;
      }
      a.input:hover {
        background:#31b0d5;
        color: #ffffff;
      }
      a{
        text-decoration:none;
        color:#FFF;
      }
      #file {
        opacity:0;
        filter:alpha(opacity=0);
        font-size:100px;
        position:absolute;
        top:0;
        right:0;
      }
      #files {
        opacity:0;
        filter:alpha(opacity=0);
        font-size:100px;
        position:absolute;
        top:0;
        right:0;
        width:70px;
        height:30px;
      }
      #next_phone {
        padding: 11px 0;
        width: 160px;
        text-align: center;
        margin-left: 24%;
        margin-top: 37px;
        background: linear-gradient(to right, #F35C3C, #F35C3C);
        -webkit-border-radius: 14px;
      }

    </style>
</head>
<body class="index_body">
<include file="Lay:heder" />
<div class="container" style="width: 100%;background:white;">
    <form action="/Admin/Order/setContractadd" id="channel_form" method="post" enctype="multipart/form-data">
        <div id="section" style="padding-top: 20px;width: 100%;">
           <div style="float: left;width:200px;height: 30px;">
                <input type="text" id="file_name" readonly="readonly"/>
                <a href="javascript:void(0);" class="input">
                    上传融资合同
                    <input type="file" id="file" name="financeleaseurl">
                </a>
           </div>
            <div style="width:200px;height: 30px;float: right;margin-right: 35%">
                <input type="text" id="file_name_data" readonly="readonly"/>
                <a href="javascript:void(0);" class="input">
                    上传抵押合同
                    <input type="file" id="files" name="mortgagecontracturl">
                </a>
           </div>
           <button type="submit" class="Next_step" id="next_phone">提交上传</button>
        </div>
        <input type="hidden" id="id1" value="{{$order['id']}}" name="order_id">
    </form>
</div>
<script src="/Public/mui/computer/js/jquery-1.11.3.js"></script>
<script type="text/javascript" src="/Public/mui/static/bower_components/sweetalert/dist/sweetalert.min.js"></script>
<script type="text/javascript" src="/Public/mui/computer/js/functions.js"></script>
<script src="/Public/mui/computer/js/back.js"></script>
<script src="/Public/mui/js/jquery.form.js"></script>
<script>
$(document).on('ready', function() {
    $("#file").change(function(){ 
        var fileSize = this.files[0].size;
        var size = fileSize / 1024 / 1024;
        $("#file_name").val($("#file").val());  
    });
    $("#files").change(function(){  
        var fileSize = this.files[0].size;
        var size = fileSize / 1024 / 1024;
        $("#file_name_data").val($("#files").val());  
    });

});
$('#channel_form').ajaxForm({
  beforeSubmit: function () {
       if(!sub()){
        return false;
       }
  },  
  success: function (res) {
        console.log(res);
        if(res['success'] == "OK"){
            sweetAlert('',res.msg,'success');
            setTimeout(function(){location.href='/admin/order/allOrderList'},2000);
        }else if(res['success'] == "ERROR"){
            sweetAlert('',res.msg,"error");
            return false;
        }
    },
    dataType: 'json',
    xhrFields: {
       withCredentials: true
    }
});

function sub(){
    var file_name_data = $('#file').val();
    var file_name = $('#files').val();
    if(file_name_data == "" || file_name==""){
        sweetAlert("",'请上传合同',"error");
        return false;
    }
    return true;
}
</script>
</body>
</html>